package cz.muni.fi.PA165.transfers;


import cz.muni.fi.PA165.dto.AuthorDTO;
import cz.muni.fi.PA165.entities.Author;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 *
 * @author Dominik
 */
public class AuthorT {
    public static AuthorDTO AuthorToDTO(Author author){
        if (author == null) {
            return null;
        }
        
        AuthorDTO authorDTO = new AuthorDTO();
        
        authorDTO.setId(author.getId());
        authorDTO.setName(author.getName());
                
        return authorDTO;        
    }
    
    public static Author DTOtoAuthor(AuthorDTO authorDTO){
        if (authorDTO == null) {
            return null;
        }
        
        Author author = new Author();
        
        author.setId(authorDTO.getId());
        author.setName(authorDTO.getName());
                
        return author;     
    }    
}
